/**
 * 将对象以树形结构组织起来,以达成“部分－整体” 的层次结构
 * 使得客户端对单个对象和组合对象的使用具有一致性
 * @author MIAO
 * Created on 2011-10-6
 * For more information, please visit:ismiao.com
 */
package designPattern;

import ismiao.com.designPattern.Composite.secondHalf2010.ConcreteCompany;
import ismiao.com.designPattern.Composite.secondHalf2010.FinanceDepartment;
import ismiao.com.designPattern.Composite.secondHalf2010.HRDepartment;

import org.junit.Before;
import org.junit.Test;

public class TestComposite {
	
	private ConcreteCompany root;
	
	@Before
	public void beforeTest(){
		 this.root = new ConcreteCompany("北京总公司");
	}
	
	@Test
	public void normalCreateCompany(){
		root.Add(new HRDepartment("总公司人事部"));
		root.Add(new FinanceDepartment("总公司账务部"));
		
		ConcreteCompany xiamen = new ConcreteCompany("厦门分公司");
		xiamen.Add(new HRDepartment("厦门分公司人事部"));
		xiamen.Add(new FinanceDepartment("厦门分公司账务部"));
		root.Add(xiamen);
		
		//其他分公司、办事处或部门做相应增设
	}
}
